{{csrf_field()}}
<div class="layui-form-item">
    <label for="" class="layui-form-label">商品分类</label>
    <div class="layui-input-block">
        <select name="category_id" lay-search  lay-filter="category_id">
            @foreach($categorys as $first)
                <option value="{{ $first['id'] }}" @if(isset($category_sku["category_id"])&&$category_sku["category_id"]==$first['id']) selected @endif>{{ $first['category_name'] }}</option>
                @if(isset($first['_child']))
                    @foreach($first['_child'] as $second)
                        <option value="{{$second['id']}}" {{ isset($category_sku["category_id"]) && $category_sku["category_id"]==$second['id'] ? 'selected' : '' }} >┗━━{{$second['category_name']}}</option>
                    @endforeach
                @endif
            @endforeach
        </select>
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">属性名称</label>
    <div class="layui-input-block">
        <input type="text" name="sku_name" value="{{ $category_sku["sku_name"] ?? old('sku_name') }}" lay-verify="required" placeholder="请输入属性名称" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">属性值</label>
    <div class="layui-input-block">
        <input type="text" name="content" value="{{ $category_sku["content"] ?? old('content') }}" lay-verify="required" placeholder="请输入属性值" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">排序</label>
    <div class="layui-input-block">
        <input type="text" name="sort" value="{{ $category_sku["sort"] ?? 0 }}" lay-verify="required|number" placeholder="请输入排序" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">必填</label>
    <div class="layui-input-block">
        <input type="radio" name="is_required" value="1" title="是" @if(isset($category_sku["is_required"])&&$category_sku["is_required"]==1) checked @endif>
        <input type="radio" name="is_required" value="2" title="否" @if(isset($category_sku["is_required"])&&$category_sku["is_required"]==2) checked @endif>
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">备注</label>
    <div class="layui-input-block">
        <input type="text" name="remark" value="{{ $category_sku["remark"] ?? old('remark') }}" lay-verify="required" placeholder="请输入备注" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">状态</label>
    <div class="layui-input-block">
        <input type="checkbox" name="status" lay-skin="switch"  lay-text="启用|停用" value="1" @if(isset($category_sku["status"])&&$category_sku["status"]==1) checked @endif >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">封面图</label>
    <div class="layui-input-block">
        <div class="layui-upload">
            <button type="button" class="layui-btn" id="uploadPic"><i class="layui-icon">&#xe67c;</i>图片上传</button>
            <div class="layui-upload-list" >
                <ul id="layui-upload-box" class="layui-clear">
                    @if(isset($article->thumb))
                        <li><img src="{{ $article->thumb }}" /><p>上传成功</p></li>
                    @endif
                </ul>
                <input type="hidden" name="thumb" id="thumb" value="{{ $article->thumb??'' }}">
            </div>
        </div>
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="submit" class="layui-btn" lay-submit="" lay-filter="formDemo">确 认</button>
        <a  class="layui-btn" href="{{route('admin.category')}}" >返 回</a>
    </div>
</div>
